<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>3、umbraconewssite：文档类型设置 | haijd</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="Umbraco入门" />
  
  
  
  
  <meta name="description" content="Umbraco入门教程">
<meta name="keywords" content="Umbraco入门">
<meta property="og:type" content="article">
<meta property="og:title" content="3、UmbracoNewsSite：文档类型设置">
<meta property="og:url" content="http://www.hais2.com/2016/01/03/Umbraco-Getting-Started-3/index.html">
<meta property="og:site_name" content="haijd">
<meta property="og:description" content="Umbraco入门教程">
<meta property="og:locale" content="default">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice4.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice5.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice6.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice7.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice8.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice9.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice10.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice11.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice16.png">
<meta property="og:image" content="http://www.hais2.com/image/umbraco/backoffice12.png">
<meta property="og:updated_time" content="2017-08-02T15:22:33.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="3、UmbracoNewsSite：文档类型设置">
<meta name="twitter:description" content="Umbraco入门教程">
<meta name="twitter:image" content="http://www.hais2.com/image/umbraco/backoffice4.png">
  
    <link rel="alternate" href="/atom.xml" title="haijd" type="application/atom+xml">
  
  <link rel="icon" href="/css/images/favicon.ico">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/9749f0/00000000000000000001008f/27/l?subset_id=2&fvd=n5) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/90cf9f/000000000000000000010091/27/l?subset_id=2&fvd=n7) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/8a5494/000000000000000000013365/27/l?subset_id=2&fvd=n4) format("woff2");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/d337d8/000000000000000000010095/27/l?subset_id=2&fvd=i4) format("woff2");font-weight:400;font-style:italic;}</style>
    
  <link rel="stylesheet" id="athemes-headings-fonts-css" href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz%3A200%2C300%2C400%2C700&amp;ver=4.6.1" type="text/css" media="all">
  <link rel="stylesheet" href="/css/style.css">

  <script src="/js/jquery-3.1.1.min.js"></script>

  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/css/bootstrap.css" >
  <link rel="stylesheet" href="/css/hiero.css" >
  <link rel="stylesheet" href="/css/glyphs.css" >
  
    <link rel="stylesheet" href="/css/vdonate.css" >
  

</head>

<script>
var themeMenus = {};

  themeMenus["/"] = "Home"; 

  themeMenus["/archives"] = "Archives"; 

  themeMenus["/categories"] = "Categories"; 

  themeMenus["/tags"] = "Tags"; 

  themeMenus["/about"] = "About"; 

</script>


  <body data-spy="scroll" data-target="#toc" data-offset="50">


  <header id="allheader" class="site-header" role="banner">
  <div class="clearfix container">
      <div class="site-branding">

          <h1 class="site-title">
            
              <a href="/" title="haijd" rel="home"> haijd </a>
            
          </h1>

          
            <div class="site-description">Stay Hungry,Stay Foolish</div>
          
            
          <nav id="main-navigation" class="main-navigation" role="navigation">
            <a class="nav-open">Menu</a>
            <a class="nav-close">Close</a>
            <div class="clearfix sf-menu">

              <ul id="main-nav" class="nmenu sf-js-enabled">
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/">Home</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/archives">Archives</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/categories">Categories</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/tags">Tags</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/about">About</a> </li>
                    
              </ul>
            </div>
          </nav>


      </div>
  </div>
</header>




  <div id="container">
    <div id="wrap">
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-Umbraco-Getting-Started-3" style="width: 66%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
  <div id="articleInner" class="clearfix post-1016 post type-post status-publish format-standard has-post-thumbnail hentry category-template-2 category-uncategorized tag-codex tag-edge-case tag-featured-image tag-image tag-template">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      3、UmbracoNewsSite：文档类型设置
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	Posted on <a href="/2016/01/03/Umbraco-Getting-Started-3/" class="article-date">
	  <time datetime="2016-01-03T05:37:04.000Z" itemprop="datePublished">January 3, 2016</time>
	</a>

      
	<span id="busuanzi_container_page_pv">
	  本文总阅读量<span id="busuanzi_value_page_pv"></span>次
	</span>

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <p>　　从这一篇开始，我们制作一个简单的新闻网站UmbracoNewsStie，用来演示Umbraco的实际使用技巧。</p>
<p>　　在开始，我们需要先创建文档类型才能进行其他的操作，文档类型就是网站要展示什么。<a id="more"></a><br>　　首先我们先做一个网站的首页，进入Umbraco的后台界面，选择<strong>Setting</strong>，点击<strong>Document Types</strong>选项右边的三个小圆点按钮，在弹出的菜单中点击<strong>Create</strong>。<br><img src="/image/umbraco/backoffice4.png" alt=""></p>
<p>　　在创建表单中输入这个文档类型的名称<strong>Home</strong>，然后勾选创建对应的模板(Create Matching template),最后点击<strong>Create</strong>按钮。<br><img src="/image/umbraco/backoffice5.png" alt=""></p>
<p>　　然后我们就进入了设置界面。可以在上面看到四个选项卡：<strong>Info、Structure、Generic properties、Tabs</strong>，Info设置当前文档类型的名称、别名(也就是数据库中存储的字段名)、图标等信息；Structure设置当前文档类型所处的结构，比如是否是根节点、其下是否需要其他节点等；Generic properties设置当前文档类型的一些属性(需要显示在网页上的字段)，Tabs设置当前文档类型在使用时的分类，结合Generic proerties使用，比如我们创建一个名为”Info”的Tabs，那么这个Info就是用来设置首页的信息字段的，还可以设置content等等Tabs。<br><img src="/image/umbraco/backoffice6.png" alt=""></p>
<p>　　我们首先创建两个Tabs，分别是首页的信息Tabs和内容Tabs。 ps:选项后面的0和1的数字是表示的Tabs显示的顺序序号，默认就可以了。<br><img src="/image/umbraco/backoffice7.png" alt=""></p>
<p>　　进入Generic properties选项卡，分别创建Info和Content需要用到的字段：站点名称、站点logo，首页内容。<br>　　点击<strong>Click here to add a new property</strong>，创建站点名称，如下图：<br>　　Name表示该属性的名称，可以设置为中文；Alias是要设置的别名，是要设置到数据库中的字段；Type表示数据类型，这里的数据类型是Umbraco自己设置的数据类型；Mandatory表示用到这个属性时，是不是需要强制设置这个属性的值；Validation用来设置一个正则表达式，用来验证该属性的值；Description设置该属性的解释说明。<br>　　填写完毕后点击右上角的<strong>Save</strong>保存按钮。<br><img src="/image/umbraco/backoffice8.png" alt=""></p>
<p>　　按照同样的方式设置其余的两个属性，注意Site Logo的类型是Upload类型。<br><img src="/image/umbraco/backoffice9.png" alt=""></p>
<p>　　设置完了文档类型的字段，我们试试创建一个网页，检验一下我们设置的这些字段，也感受一下umbraco是怎么工作的。<br>　　接下来选择<strong>Content</strong>选项，点击后面的三个小圆点按钮，在弹出的菜单中选择要创建的文档类型，这里只创建了一个Home，我们就选择这个。<br><img src="/image/umbraco/backoffice10.png" alt=""></p>
<p>　　点击<strong>Create</strong>按钮之后，会弹出设置界面，这是我们会发现，我们在<strong>Home</strong>文档类型中设置的<strong>Info</strong>和<strong>Content</strong>这两个Tabs都在这里出现了，而且在设置在其下的属性也都在这里。<br>　　我们分别填写这几个内容和上传一张图片作为logo。<br><img src="/image/umbraco/backoffice11.png" alt=""><img src="/image/umbraco/backoffice16.png" alt=""></p>
<p>　　最后点击<strong>Save and publish</strong>按钮进行保存和提交发布。发布之后，我们的设置的属性字段，就存储到了Umbraco的数据库中，接下来，我们就要设置如何展示这些属性的数据。<br><img src="/image/umbraco/backoffice12.png" alt=""></p>
<p>　　</p>

      
    </div>
    <footer class="entry-meta entry-footer">
      
	<span class="ico-folder"></span>
    <a class="article-category-link" href="/categories/Umbraco/">Umbraco</a>

      
  <span class="ico-tags"></span>
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Umbraco入门/">Umbraco入门</a></li></ul>

      
        <div id="donation_div"></div>

<script src="/js/vdonate.js"></script>
<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: '/css/images/wechatPay.png',
  alipayImage: '/css/images/alipay.jpg'
});
</script>
      

      
        
	<section id="comments" class="comment">
	  <div id="disqus_thread">
	  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
	  </div>
	</section>

	<script type="text/javascript">
	var disqus_shortname = 'haijdblog';
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/count.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	</script>


      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2016/01/04/Umbraco-Getting-Started-4/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          4、UmbracoNewsSite：Templates展示内容数据
        
      </div>
    </a>
  
  
    <a href="/2016/01/02/Umbraco-Getting-Started-2/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">2、Umbraco后台管理功能介绍</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
      <ol class="nav">None</ol>
    
    </div>
  </aside>
</section>
        
      </div>
      <footer id="footer" class="site-footer">
  

  <div class="clearfix container">
      <div class="site-info">
	      &copy; 2018 haijd All Rights Reserved.
          
            <span id="busuanzi_container_site_uv">
              本站访客数<span id="busuanzi_value_site_uv"></span>人次  
              本站总访问量<span id="busuanzi_value_site_pv"></span>次
            </span>
          
      </div>
      <div class="site-credit">
        Theme by <a href="https://github.com/iTimeTraveler/hexo-theme-hiero" target="_blank">hiero</a>
      </div>
  </div>
</footer>


<!-- min height -->

<script>
    var contentdiv = document.getElementById("content");

    contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("allheader").offsetHeight - document.getElementById("footer").offsetHeight + "px";
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/categories" class="mobile-nav-link">Categories</a>
  
    <a href="/tags" class="mobile-nav-link">Tags</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/scripts.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/main.js"></script>








	<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/js/totop.js" async=""></script>
</body>
</html>
